<?php
class Default_Form_Partner extends Zend_Form
{

    public function init()
    {
        $this->setName("partner");
        $this->setAttrib('enctype','multipart/form-data');
        
        $partnerId = new Zend_Form_Element_Text('partnerId');
        $partnerId->setLabel('Mã partner')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
        $partnerId->setAttrib('size', 60);
        
        $partnerName = new Zend_Form_Element_Text('partnerName');
        $partnerName->setLabel('Tên partner')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
        $partnerName->setAttrib('size', 60);
       
        $partnerImg = new Zend_Form_Element_File('partnerImg');
        $partnerImg->setLabel('Hình ảnh');
        $partnerImg->addValidator('Extension',true,array('jpg','gif','png'),'picture');
        $partnerImg->addValidator('Size',true,array('min'=>'10KB','max'=>'2000KB'),'filezip'); 
        $partnerImg->setAttrib('size', 60);
        
        $openDate = new Zend_Form_Element_Text('openDate');
        $openDate->setLabel('Ngày bắt đầu')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
        $openDate->setAttrib('class', 'datepicker');
        $openDate->setAttrib('readonly', 'readonly');
        

        $status = new Zend_Form_Element_Select('status');
        $status->setLabel('Trạng thái');
        $status->addMultiOption('1','Đang chạy');
        $status->addMultiOption('0','Đã dừng');
        
        $partnerConfig = new Zend_Form_Element_Textarea('partnerConfig');
        $partnerConfig->setLabel('Cấu hình')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
        
        // submit button
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setAttrib('id','submitbutton');
        $submit->setAttrib('class',"button medium");
                
        // add elements to form
        $this->addElements(array (
            $partnerId, $partnerName,  $partnerImg, $openDate, $status, $submit//$catId, 
        ));
    }
}

